package com.example.adminbase.service;

import com.example.adminbase.domain.EncryptUtil;
import com.example.adminbase.domain.SysUser;
import com.example.adminbase.domain.UserQueryParam;
import com.github.pagehelper.Page;

public interface SysUserService extends CrudService<String, SysUser> {

    Page<SysUser> findBy(UserQueryParam queryParam);

    void updatePassword(String id, String password);

    // todo: 对业务实体的属性进行验证
    @Override
    default boolean beforeSave(SysUser record) {
        record.setPassword(EncryptUtil.encryptPassword(record.getPassword()));
        record.beforeInsert();
        return true;
    }
}
